package com.firesyde.gwt.persistence;

import java.util.List;

import com.firesyde.gwt.persistence.client.StorableDAO;

public interface IDataManager {

	public abstract void close();

	/**
	 * Check whether the record with the given key exists
	 * @param key
	 * @return exists whether or not the record exists
	 */
	public abstract boolean exists(String key);

	/**
	 * Store the object in the database
	 * @param record
	 */
	public abstract <T extends StorableDAO> void store(T record);

	/**
	 * Fetch all records
	 * @param fetchClass
	 * @return
	 */
	public abstract <T extends StorableDAO> List<T> fetchAll(Class<T> fetchClass);

	/**
	 * Fetch one or more records matching a key
	 * @param key
	 * @param fetchClass
	 * @return
	 */
	public abstract <T extends StorableDAO> T fetch(String[] keys, Object[] values, Class<T> fetchClass);

}